<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Array Test </title>
</head>

<body>
    <script>
        let array = [{
            name: 'aaa',
            age: 18,
            no: 1
        }, {
            name: 'bbb',
            age: 17,
            no: 2
        }, {
            name: 'ccc',
            age: 15,
            no: 3
        }, {
            name: 'ddd',
            age: 12,
            no: 4
        }, {
            name: 'eee',
            age: 8,
            no: 5
        }, {
            name: 'fff',
            age: 16,
            no: 6
        }]
        let newArr = array.map(item => item.no)
        console.log('newArr', newArr)
        let nos = newArr.join(',')
        console.log('nos', nos)




        // filter 顺序
        let allData = [{
            name: 'aaa',
            age: 18,
            no: 1
        }, {
            name: 'bbb',
            age: 17,
            no: 2
        }, {
            name: 'ccc',
            age: 15,
            no: 3
        }, {
            name: 'ddd',
            age: 12,
            no: 4
        }, {
            name: 'eee',
            age: 8,
            no: 5
        }, {
            name: 'fff',
            age: 16,
            no: 6
        }]

        let selectedData = [{
            name: 'eee',
            age: 8,
            no: 5
        }, {
            name: 'ccc',
            age: 15,
            no: 3
        }, ]

        let tableData = allData.filter(item => !selectedData.some(sel => item.no === sel.no))
        console.log(tableData)
    </script>
</body>

</html>